import {PropType} from "vue";
import {CrudTableColumn} from "../CrudTableColumn";
import {DetailConfig, FilterCondition, type FormConfig} from "@/components/crud/types";

export const crudTableProps =  {
    hasEdit: { // 是否有编辑按钮
        type: Boolean,
        default: true,
    },
    url: {
        type: String,
        required: true,
    },
    createConfig: {
        type: Array as PropType<FormConfig[]>,
    },
    updateConfig: {
        type: Array as PropType<FormConfig[]>,
    },
    hasDelete: { // 是否有删除按钮
        type: Boolean,
        default: true,
    },
    hasDetail: { // 是否有详情按钮,默认隐藏，因为编辑也可以看详情。
        type: Boolean,
        default: true,
    },
    detailOptions: {
        type: Array as PropType<DetailConfig[]>,
    },
    columns: {
        type:Array as PropType<CrudTableColumn[]>,
    },
    filters: {
        type: Array as PropType<FilterCondition[]>,
        default: () => []
    },
    filterOptions: Array as PropType<FilterCondition[]>,
}
